﻿using System;
using Token.Piker.Common;

namespace Token.Piker.Web.Admin.Tag
{
    public partial class Add : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (Session[GlobalConstants.PIKER_ADMIN] == null)
            {
                MessageBox.ShowAndRedirect(this.Page, "网络连接超时，请重新登录！", ResolveClientUrl("~/Admin/Login.aspx"));
                return;
            }
            string TagName = this.txtTagName.Text;
            int Adder = Convert.ToInt32(Session[GlobalConstants.PIKER_ADMIN]);
            DateTime AddTime = DateTime.Now;
            int Flag = int.Parse(ddlFlag.SelectedValue);

            Token.Piker.Model.Tag model = new Token.Piker.Model.Tag();
            model.TagName = TagName;
            model.Adder = Adder;
            model.AddTime = AddTime;
            model.Flag = Flag;

            Token.Piker.BLL.TagBLL bll = new Token.Piker.BLL.TagBLL();
            bll.Add(model);
            MessageBox.ShowAndRedirect(this, "保存成功！", "Add.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}